package org.itboys.core.controller.front;

import com.aliyuncs.exceptions.ClientException;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import org.itboys.commons.CommonConstants;
import org.itboys.commons.dto.ResultPageDOHelper;
import org.itboys.commons.utils.ajax.AjaxUtils;
import org.itboys.framework.spring.controller.BaseController;
import org.itboys.core.service.mongo.front.SundayValicodedateService;
import org.itboys.core.util.ResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 作者：zzq
 * 时间：2017/9/4
 * 描述：验证码
 */
@Controller
@RequestMapping("/sunday/small/code")
@Api(value = "code", description = "验证码")
public class SundayFrontValiDateCodeController extends BaseController {
    @Autowired
    private SundayValicodedateService codeService;

    @RequestMapping(value = "/send", method = {RequestMethod.POST})
    @ApiOperation(value = "发送验证码")
    public void send(
            HttpServletRequest request,
            HttpServletResponse response,
            @RequestParam(value = "mobile", required = true) String mobile
    ) throws ClientException, IOException {
        codeService.sendValidateCode(mobile);
        ResponseMessage.success();
    }
}
